<template>
  <el-form style="margin: 20px 150px 0px 100px; height: auto" ref="form" :model="form" label-width="80px">
    <el-form-item label="客户名" required>
      <el-input v-model="form.cName"></el-input>
    </el-form-item>

    <el-form-item label="客户id" required>
      <el-input v-model="form.cId"></el-input>
    </el-form-item>,

    <el-form-item label="昵称" required>
      <el-input v-model="form.cUsername"></el-input>
    </el-form-item>
    <el-form-item label="设置密码" required>
      <el-input v-model="form.cPwd" type="password"></el-input>
    </el-form-item>
    <el-form-item label="客户座机">
      <el-input v-model="form.cTel"></el-input>
    </el-form-item>

    <el-form-item label="联系电话" required>
      <el-input v-model="form.cPhoneNumber"></el-input>
    </el-form-item>

    <el-form-item label="qq">
      <el-input v-model="form.cQNumber"></el-input>
    </el-form-item>

    <el-form-item label="电子邮件" required>
      <el-input v-model="form.cEmail"></el-input>
    </el-form-item>

    <el-form-item label="工作单位">
      <el-input v-model="form.cUnit"></el-input>
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="onSubmit">确认</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
  import Global from '../../utils/global'

  export default {
    name: 'ProManAddClient',
    data(){
      return{
        glo:new Global,
        form: {
          cName:null,
          cId:null,
          cTel:null,
          cPhoneNumber: null,
          cQNumber:null,
          cEmail: null,
          cUsername: null,
          cUnit:null,
          cPwd:null
        }
      }
    },
    methods: {
      onSubmit() {
        console.log('submit!');
        var client = this.form
        client.cId = eval(client.cId)
        this.glo.sendDate(this.glo.server + "frontDesk/addClient", client, this.handleAddClient,"POST")

      },
      handleAddClient(res){
        console.log(res);
        let feedBack = eval(res);
        if (feedBack.success == false) {//登录失败
          this.$message.error(feedback.message);
          return;
        }
        this.$message.success("客户添加成功√")
        return;
      }
    },
  }
</script>

<style scoped>

</style>
